﻿using JuCloudy.Framework.Storge;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace JuCloudy.App.Toursim.Root.ctrls
{
    public partial class Open : UserControl
    {
        public Open()
        {
            InitializeComponent();

            this.Loaded += (obj, e) =>
            {
                OnLoad();
            };
        }

        public void OnLoad()
        {
            this._list.Items.Clear();
            var tProducts = Session.Client["tProducts"] as ObservableCollection<AppDataService.AppToursimProduct>;
            var tContents= Session.Client["tContents"] as ObservableCollection<AppDataService.AppToursimContent>;
            foreach(var entity in tContents.OrderBy(p=>p.CreateDate))
            {
                ListBoxItem item = new ListBoxItem();
                item.Content = entity.Title;
                item.Tag = entity;
                this._list.Items.Add(item);
            }

        }
    }
}
